<?php
class User_Form_UpdateAddress extends Zend_Form
{
	/**
	 * Form for update address
	 * @author Nguyen Manh Hung
	 */
	public function init()
	{
		$this->setAction ( '' )
          ->setMethod ( 'post' );
          
        $id = $this->createElement('Hidden','id');
        $title = $this->createElement('select','gioi_tinh');
        $title->setLabel('Giới tính')
              ->setMultiOptions(array('1'=>'Nam', '0'=>'Nữ'))
              ->setRequired(true)->addValidator('NotEmpty', true);
              
		$firstName = $this->createElement('text', 'ho');
		$firstName->setLabel('Họ:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('size',50)
				->addValidator ( 'stringLength', false, array (3, 100 ) )
				->addValidator('NotEmpty');
				
		$lastName = $this->createElement('text', 'ten');
		$lastName->setLabel('Tên:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('size',50)
				->addValidator ( 'stringLength', false, array (3, 100 ) )
				->addValidator('NotEmpty');
				
		$address = $this->createElement('text', 'address');
		$address->setLabel('Địa chỉ:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->setAttrib('size',50)
				->addValidator ( 'stringLength', false, array (10, 200 ) )
				->addValidator('NotEmpty');
				
		$phone = $this->createElement('text', 'phone');
		$phone->setLabel('Số điện thoại:')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->addFilter('Int')
				->setAttrib('size',50)
				->addValidator('NotEmpty');
		
		$dfAddress = $this->createElement('checkbox','default_address',array('label' => 'Địa chỉ mặc định:','checkedValue' => 1,'uncheckedValue' => 0));		
		
		$submit = $this->createElement('submit', 'submit');
        $submit->setAttrib('id', 'submit_register')
        		->setAttrib('class', 'formbutton');
        $submit->setLabel('Đồng ý');
        $submit->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb', 'class'=>'btn') ,array('Label', array('tag' => '')))));      
        $reset = $this->createElement('reset','reset',array ('label' => 'Làm lại'));  
        
        $reset->setAttrib('class', 'formbutton');        
        $reset->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb') ,array('Label', array('tag' => '')))));      
        $cancel = $this->createElement('button','back',array ('label' => 'Quay lại'));
        $cancel->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'hb') ,array('Label', array('tag' => '')))));
        $cancel->setAttrib('class', 'formbutton');   
        
        $this->addElement ( $title )
        	->addElement ( $firstName )
        	->addElement($lastName)
           	->addElement($address)
           	->addElement($phone)
           	->addElement($dfAddress)
           	->addElement($submit)
           	->addElement($reset)
           	->addElement($cancel);
	}
}